package ModelLayer;


/**
 * Write a description of class Loan here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Loan
{
    // instance variables - replace the example below with your own
    private int id;
    private String date;
    private int period;
    private Copy copy;
    private Person person;
    
    public Loan(int id, String date, int period, Copy copy, Person person)
    {
        this.id = id;
        this.date = date;
        this.period = period;
        this.copy = copy;
        this.person = person;
    }
    
    public void setId(int id)
    {
        this.id = id;
    }

    public int getId()
    {
        return id;
    }
    
    public void setDate(String date)
    {
        this.date = date;
    }

    public String getDate()
    {
        return date;
    }
    
    public void setPeriod(int period)
    {
        this.period = period;
    }

    public int getPeriod()
    {
        return period;
    }
    
    
    public void setCopy(Copy copy)
    {
        this.copy = copy;
    }

    public Copy getCopy()
    {
        return copy;
    }
    
    public Person getPerson()
    {
        return person;
    }
    
    public void deleteCopy()
    {
        copy=null;
    }
    
    public void deletePerson()
    {
        person=null;
    }
    
    
    public void deletePC()
    {
        deleteCopy();
        deletePerson();
    }
    
    
    public String toString()
    {
        String s="Loan ID=" + getId() + '\n' + "Period=" + getPeriod() + '\n' + "Date=" + getDate()+ '\n';
        s+="Loaner's name= " + getPerson().getName() + '\n';
        s+="Copy's serial number=" +getCopy().getSerialNumber();
        return s;
    }
    
    
    
    
    
    
}